package com.zhutengwei.android.zuji.db;

import android.database.Cursor;

import com.zhutengwei.android.zuji.model.ZujiModel;

/**
 * Created by Administrator on 2016/12/20.
 */
public class ZujiCursorWrapper extends android.database.CursorWrapper {
    /**
     * Creates a cursor wrapper.
     *
     * @param cursor The underlying cursor to wrap.
     */
    public ZujiCursorWrapper(Cursor cursor) {
        super(cursor);
    }

    public ZujiModel getZuji(){
        int id = getInt(getColumnIndex(ZujiTable.COLUMN_ID));
        String email = getString(getColumnIndex(ZujiTable.COLUMN_EMAIL));
        String category = getString(getColumnIndex(ZujiTable.COLUMN_CATEGORY));
        String title = getString(getColumnIndex(ZujiTable.COLUMN_TITLE));
        String content = getString(getColumnIndex(ZujiTable.COLUMN_CONTENT));
        String latitude = getString(getColumnIndex(ZujiTable.COLUMN_LATITUDE));
        String longitude = getString(getColumnIndex(ZujiTable.COLUMN_LONGITUDE));
        String imgdata = getString(getColumnIndex(ZujiTable.COLUMN_IMGDATA));
        String date = getString(getColumnIndex(ZujiTable.COLUMN_DATE));

        ZujiModel zuji = new ZujiModel(email, category, title,
                content, latitude, longitude, imgdata, date);
        zuji.setId(id);
        return zuji;
    }

}
